# Maintainer: Tim Meusel <tim@bastelfreak.de>

_gemname='rr'
pkgname="ruby-${_gemname}"
pkgver=3.1.0
pkgrel=1
pkgdesc='RR is a test double framework that features a rich selection of double techniques and a terse syntax'
arch=('any')
url='https://github.com/rr/rr'
license=('MIT')
# ruby-rr requires ruby-test-unit-rr to run it's tests.
# ruby-test-unit-rr already has ruby-rr as a runtime dependency
makedepends=('ruby-rdoc' 'ruby-rake' 'ruby-bundler' 'ruby-rspec')
checkdepends=('ruby-test-unit-rr' 'ruby-test-unit')
depends=('ruby')
options=(!emptydirs)
source=("${url}/archive/v${pkgver}/${pkgname}-v${pkgver}.tar.gz")
sha512sums=('d05d8421d5cd6e9225cbf5ca183c54cc510a3212f0629f7cee60887b18c874618cb67836503aed7665cef8443cc579306b84e030ae1ec0834f56298f5044a2fa')

build() {
  cd "${_gemname}-${pkgver}"
  rake build
}

check() {
  cd "${_gemname}-${pkgver}"
  rake test
}

package() {
  cd "${_gemname}-${pkgver}"
  local _gemdir="$(gem env gemdir)"
  gem install --verbose --ignore-dependencies --no-user-install --install-dir "${pkgdir}/${_gemdir}" --bindir "${pkgdir}/usr/bin" "pkg/${_gemname}-${pkgver}.gem"

  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
  install -Dm 644 README.md CHANGES.md CREDITS.md FOR_DEVELOPERS.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  mv doc "${pkgdir}/usr/share/licenses/${pkgname}/"

  rm -rf "${pkgdir}/${_gemdir}/cache"
}

# vim: ts=2 sw=2 et:
